
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'LFormMultiSelectLogic.dart';
import 'LFormMultiSelectState.dart';

class LFormMultiSelectPage extends StatelessWidget {

  const LFormMultiSelectPage({super.key, required this.tag});
  final String tag;


  @override
  Widget build(BuildContext context) {
    final LFormMultiSelectState state = Get.find<LFormMultiSelectLogic>(tag: tag).state;
    return GetBuilder<LFormMultiSelectLogic>(
      // assignId:true,
      // autoRemove:true,
      tag: tag,
      // id: state.id,
      builder: (logic){
        return TextFormField(
          readOnly: true,
          controller: TextEditingController.fromValue(TextEditingValue(text:state.defaultText)),
          decoration: const InputDecoration(
            hintText: "请选择",
            enabledBorder: InputBorder.none,
            disabledBorder: InputBorder.none,
            focusedBorder: InputBorder.none,
          ),
          onChanged:(v){},
          onSaved: (v){},
          validator: (v) {
            return logic.onValidator(v);
          },
          onTap: (){
            //底部弹出
            if(state.formItem["readonly"]!=true){
              logic.showCustomModalBottomSheet(context,tag);
            }
          },
        );


      }
    );



  }

}